// 验证规则
const [account, username, mobile, password,passwordNew, smscode, smskey, read, type, nickname,email] = [
  
  [
    {required: true, message: '请填写用户名'},
    {min: 3, max: 25, message: '用户名长度为3-25'},
	{pattern: /^(?!\d+$)\w+$/, message: '只允许字母或数字+字母'}
  ],	
  [
    {required: true, message: '请填写账号'},
    {min: 3, max: 25, message: '账号长度为3-25'},
	
  ],
  [
    {required: true, message: '请填写手机号'},
    {pattern: /^1[3456789]\d{9}$/, message: '手机号格式不正确'}
  ],
  [
    {required: true, message: '请填写密码'},
    {min:6, max:30, message: '密码长度6-30之间'}
  ],
  [
    {required: true, message: '请填写新密码'},
    {min:6, max:30, message: '密码长度6-30之间'}
  ],
  [
    {required: true, message: '请填写短信验证码'},
    {len: 6, message: '验证码为6位数字'}
  ],
  [
    {required: true, message: '请先获取验证码'},
  ],
  [
    {required: true, pattern: /^1$/, message: '请确认阅读了《用户注册协议》'},
  ],
  [
    {required: true, type: "enum", enum: [0, 1], message: '请选择注册类型'}
  ],
  [
    {required: true, message: '请填写账号'},
    {min: 3, max: 23, message: '昵称长度为3-25之间。'},
  ],
  [
    {required: true, message: '请填写电子邮箱'},
    {
		type: 'email',
		transform(value) {
			return value.trim();
		},
		message: '电子邮箱格式不正确',
	},
  ],
];

// 验证场景
const scene = {
  register: {mobile, password, smscode, smskey, read, type},
  login: {username, password},
  mobile: {mobile},
  mobileLogin: {mobile, smscode, smskey},
  resetPassword: {mobile, smscode, smskey, password},
  changeMobile: {mobile, smscode, smskey},
  changePassword:{password,passwordNew},
  nickname: {nickname},
  account:{account},
  email:{email},
};

export default scene;
